home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_01 / allison / stack1.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-07  |  219 b   |  19 lines

  1. // stack1.cpp
  2. #include "stack1.h"
  3.  
  4. void Stack::push(int x)
  5. {
  6.     if (ptr < size)
  7.         data[ptr++] = x;
  8. }
  9.  
  10. int Stack::pop()
  11. {
  12.     if (ptr > 0)
  13.         --ptr;
  14.     return data[ptr];
  15. }
  16.  
  17. // End of File
  18.  
  19.